Integrand size = 17, antiderivative size = 151 \[ \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx=-\frac {e^{-i \left (a-\frac {b^2}{4 i+4 c}\right )} \sqrt {\pi } \text {erfi}\left (\frac {i b-2 (1-i c) x}{2 \sqrt {1-i c}}\right )}{4 \sqrt {1-i c}}+\frac {e^{i a+\frac {b^2}{4 (1+i c)}} \sqrt {\pi } \text {erfi}\left (\frac {i b+2 (1+i c) x}{2 \sqrt {1+i c}}\right )}{4 \sqrt {1+i c}} \]
-1/4*erfi(1/2*(I*b-2*(1-I*c)*x)/(1-I*c)^(1/2))*Pi^(1/2)/exp(I*(a-b^2/(4*I+ 4*c)))/(1-I*c)^(1/2)+1/4*exp(I*a+1/4*b^2/(1+I*c))*erfi(1/2*(I*b+2*(1+I*c)* x)/(1+I*c)^(1/2))*Pi^(1/2)/(1+I*c)^(1/2)
Time = 0.42 (sec) , antiderivative size = 166, normalized size of antiderivative = 1.10 \[ \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx=\frac {\sqrt [4]{-1} e^{\frac {i b^2}{4 i-4 c}} \sqrt {\pi } \left (-\left ((-i+c) \sqrt {i+c} e^{\frac {i b^2 c}{2+2 c^2}} \text {erfi}\left (\frac {(-1)^{3/4} (b+2 (i+c) x)}{2 \sqrt {i+c}}\right ) (\cos (a)-i \sin (a))\right )+\sqrt {-i+c} (i+c) \text {erfi}\left (\frac {\sqrt [4]{-1} (b+2 (-i+c) x)}{2 \sqrt {-i+c}}\right ) (-i \cos (a)+\sin (a))\right )}{4 \left (1+c^2\right )} \]
((-1)^(1/4)*E^((I*b^2)/(4*I - 4*c))*Sqrt[Pi]*(-((-I + c)*Sqrt[I + c]*E^((I *b^2*c)/(2 + 2*c^2))*Erfi[((-1)^(3/4)*(b + 2*(I + c)*x))/(2*Sqrt[I + c])]* (Cos[a] - I*Sin[a])) + Sqrt[-I + c]*(I + c)*Erfi[((-1)^(1/4)*(b + 2*(-I + c)*x))/(2*Sqrt[-I + c])]*((-I)*Cos[a] + Sin[a])))/(4*(1 + c^2))
Time = 0.35 (sec) , antiderivative size = 151, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {4976, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx\) |
\(\Big \downarrow \) 4976 |
\(\displaystyle \int \left (\frac {1}{2} e^{-i a-i b x+(1-i c) x^2}+\frac {1}{2} e^{i a+i b x+(1+i c) x^2}\right )dx\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {\sqrt {\pi } e^{i a+\frac {b^2}{4 (1+i c)}} \text {erfi}\left (\frac {i b+2 (1+i c) x}{2 \sqrt {1+i c}}\right )}{4 \sqrt {1+i c}}-\frac {\sqrt {\pi } e^{-i \left (a-\frac {b^2}{4 c+4 i}\right )} \text {erfi}\left (\frac {i b-2 (1-i c) x}{2 \sqrt {1-i c}}\right )}{4 \sqrt {1-i c}}\) |
-1/4*(Sqrt[Pi]*Erfi[(I*b - 2*(1 - I*c)*x)/(2*Sqrt[1 - I*c])])/(Sqrt[1 - I* c]*E^(I*(a - b^2/(4*I + 4*c)))) + (E^(I*a + b^2/(4*(1 + I*c)))*Sqrt[Pi]*Er fi[(I*b + 2*(1 + I*c)*x)/(2*Sqrt[1 + I*c])])/(4*Sqrt[1 + I*c])
3.2.9.3.1 Defintions of rubi rules used
Int[Cos[v_]^(n_.)*(F_)^(u_), x_Symbol] :> Int[ExpandTrigToExp[F^u, Cos[v]^n , x], x] /; FreeQ[F, x] && (LinearQ[u, x] || PolyQ[u, x, 2]) && (LinearQ[v, x] || PolyQ[v, x, 2]) && IGtQ[n, 0]
Time = 0.39 (sec) , antiderivative size = 127, normalized size of antiderivative = 0.84
method | result | size |
risch | \(\frac {\sqrt {\pi }\, {\mathrm e}^{\frac {4 a c +4 i a -b^{2}}{4 i c -4}} \operatorname {erf}\left (\sqrt {i c -1}\, x +\frac {i b}{2 \sqrt {i c -1}}\right )}{4 \sqrt {i c -1}}-\frac {\sqrt {\pi }\, {\mathrm e}^{-\frac {4 a c -4 i a -b^{2}}{4 \left (i c +1\right )}} \operatorname {erf}\left (-\sqrt {-i c -1}\, x +\frac {i b}{2 \sqrt {-i c -1}}\right )}{4 \sqrt {-i c -1}}\) | \(127\) |
1/4*Pi^(1/2)*exp(1/4*(4*a*c+4*I*a-b^2)/(I*c-1))/(I*c-1)^(1/2)*erf((I*c-1)^ (1/2)*x+1/2*I*b/(I*c-1)^(1/2))-1/4*Pi^(1/2)*exp(-1/4*(4*a*c-4*I*a-b^2)/(1+ I*c))/(-I*c-1)^(1/2)*erf(-(-I*c-1)^(1/2)*x+1/2*I*b/(-I*c-1)^(1/2))
Time = 0.25 (sec) , antiderivative size = 164, normalized size of antiderivative = 1.09 \[ \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx=\frac {\sqrt {\pi } {\left (i \, c + 1\right )} \sqrt {i \, c - 1} \operatorname {erf}\left (-\frac {{\left (b c + 2 \, {\left (c^{2} + 1\right )} x - i \, b\right )} \sqrt {i \, c - 1}}{2 \, {\left (c^{2} + 1\right )}}\right ) e^{\left (\frac {i \, b^{2} c - 4 i \, a c^{2} + b^{2} - 4 i \, a}{4 \, {\left (c^{2} + 1\right )}}\right )} + \sqrt {\pi } {\left (i \, c - 1\right )} \sqrt {-i \, c - 1} \operatorname {erf}\left (\frac {{\left (b c + 2 \, {\left (c^{2} + 1\right )} x + i \, b\right )} \sqrt {-i \, c - 1}}{2 \, {\left (c^{2} + 1\right )}}\right ) e^{\left (\frac {-i \, b^{2} c + 4 i \, a c^{2} + b^{2} + 4 i \, a}{4 \, {\left (c^{2} + 1\right )}}\right )}}{4 \, {\left (c^{2} + 1\right )}} \]
1/4*(sqrt(pi)*(I*c + 1)*sqrt(I*c - 1)*erf(-1/2*(b*c + 2*(c^2 + 1)*x - I*b) *sqrt(I*c - 1)/(c^2 + 1))*e^(1/4*(I*b^2*c - 4*I*a*c^2 + b^2 - 4*I*a)/(c^2 + 1)) + sqrt(pi)*(I*c - 1)*sqrt(-I*c - 1)*erf(1/2*(b*c + 2*(c^2 + 1)*x + I *b)*sqrt(-I*c - 1)/(c^2 + 1))*e^(1/4*(-I*b^2*c + 4*I*a*c^2 + b^2 + 4*I*a)/ (c^2 + 1)))/(c^2 + 1)
\[ \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx=\int e^{x^{2}} \cos {\left (a + b x + c x^{2} \right )}\, dx \]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 474 vs. \(2 (101) = 202\).
Time = 0.22 (sec) , antiderivative size = 474, normalized size of antiderivative = 3.14 \[ \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx=\frac {\sqrt {\pi } \sqrt {2 \, c^{2} + 2} {\left ({\left (-i \, \cos \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right ) e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} - e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} \sin \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right )\right )} \operatorname {erf}\left (-\frac {2 \, {\left (-i \, c + 1\right )} x - i \, b}{2 \, \sqrt {i \, c - 1}}\right ) + {\left (-i \, \cos \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right ) e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} + e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} \sin \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right )\right )} \operatorname {erf}\left (-\frac {2 \, {\left (-i \, c - 1\right )} x - i \, b}{2 \, \sqrt {-i \, c - 1}}\right )\right )} \sqrt {\sqrt {c^{2} + 1} + 1} + \sqrt {\pi } \sqrt {2 \, c^{2} + 2} {\left ({\left (\cos \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right ) e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} - i \, e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} \sin \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right )\right )} \operatorname {erf}\left (-\frac {2 \, {\left (-i \, c + 1\right )} x - i \, b}{2 \, \sqrt {i \, c - 1}}\right ) - {\left (\cos \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right ) e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} + i \, e^{\left (\frac {b^{2}}{4 \, {\left (c^{2} + 1\right )}}\right )} \sin \left (-\frac {b^{2} c - 4 \, a c^{2} - 4 \, a}{4 \, {\left (c^{2} + 1\right )}}\right )\right )} \operatorname {erf}\left (-\frac {2 \, {\left (-i \, c - 1\right )} x - i \, b}{2 \, \sqrt {-i \, c - 1}}\right )\right )} \sqrt {\sqrt {c^{2} + 1} - 1}}{8 \, {\left (c^{2} + 1\right )}} \]
1/8*(sqrt(pi)*sqrt(2*c^2 + 2)*((-I*cos(-1/4*(b^2*c - 4*a*c^2 - 4*a)/(c^2 + 1))*e^(1/4*b^2/(c^2 + 1)) - e^(1/4*b^2/(c^2 + 1))*sin(-1/4*(b^2*c - 4*a*c ^2 - 4*a)/(c^2 + 1)))*erf(-1/2*(2*(-I*c + 1)*x - I*b)/sqrt(I*c - 1)) + (-I *cos(-1/4*(b^2*c - 4*a*c^2 - 4*a)/(c^2 + 1))*e^(1/4*b^2/(c^2 + 1)) + e^(1/ 4*b^2/(c^2 + 1))*sin(-1/4*(b^2*c - 4*a*c^2 - 4*a)/(c^2 + 1)))*erf(-1/2*(2* (-I*c - 1)*x - I*b)/sqrt(-I*c - 1)))*sqrt(sqrt(c^2 + 1) + 1) + sqrt(pi)*sq rt(2*c^2 + 2)*((cos(-1/4*(b^2*c - 4*a*c^2 - 4*a)/(c^2 + 1))*e^(1/4*b^2/(c^ 2 + 1)) - I*e^(1/4*b^2/(c^2 + 1))*sin(-1/4*(b^2*c - 4*a*c^2 - 4*a)/(c^2 + 1)))*erf(-1/2*(2*(-I*c + 1)*x - I*b)/sqrt(I*c - 1)) - (cos(-1/4*(b^2*c - 4 *a*c^2 - 4*a)/(c^2 + 1))*e^(1/4*b^2/(c^2 + 1)) + I*e^(1/4*b^2/(c^2 + 1))*s in(-1/4*(b^2*c - 4*a*c^2 - 4*a)/(c^2 + 1)))*erf(-1/2*(2*(-I*c - 1)*x - I*b )/sqrt(-I*c - 1)))*sqrt(sqrt(c^2 + 1) - 1))/(c^2 + 1)
\[ \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx=\int { \cos \left (c x^{2} + b x + a\right ) e^{\left (x^{2}\right )} \,d x } \]
Timed out. \[ \int e^{x^2} \cos \left (a+b x+c x^2\right ) \, dx=\int {\mathrm {e}}^{x^2}\,\cos \left (c\,x^2+b\,x+a\right ) \,d x \]